/*
 * @author: sanbao
 * @Date: 2022-07-24 14:16:06
 */
import request from "@/utils/request";
/**
 * 数据
 * @param pagenum 
 * @param pagesize 
 * @param data 
 * @returns 
 */
const postgoodslist = (pagenum: number, pagesize: number, data = '') => {
    // http://47.108.251.106:8881/api/private/v1/goods?query=&pagenum=1&pagesize=6
    return request({
        url: `goods?query=${data}&pagenum=${pagenum}&pagesize=${pagesize}`,
        method: 'GET',
    })
}
/**
 * 删除
 * @param id 
 * @returns 
 */
const deletegoodslist = (id: number) => {
    return request({
        url: `goods/${id}`,
        method: 'DELETE',
    })
}
// http://47.108.251.106:8881/api/private/v1/categories
//
const getcategorieslist = () => {
    return request({
        url: 'categories',
        method: 'GET',
    })
}

// ////////
//
const addattributesmany = (id: number, state: any) => {
    // http://47.108.251.106:8881/api/private/v1/categories/368/attributes?sel=many
    return request({
        url: `categories/${id}/attributes?sel=${state}`,
        method: 'GET',
    })
}
//
const addshoplist = (data: object) => {
    return request({
        url: 'goods',
        method: 'POST',
        data
    })
}
export default {
    postgoodslist,
    deletegoodslist,
    getcategorieslist,
    addattributesmany,
    addshoplist
}